<template>
  <div class="message">
    <img :src="info.avatar" alt="">
    <div class="content">
      <p>
        <span>{{info.username}}:</span>
        {{info.message}}
      </p>
      <p class="time">
        <span>{{info.time}}</span>
        <span class="del" @click="$emit('del', info.id)">删除</span>
      </p>
    </div>
  </div>
</template>

<script>
export default {
    props:['info']
}
</script>

<style lang="scss" scoped>
.message {
  padding: 10px;
  border-bottom: 1px dashed;
  display: flex;
  img {
    width: 50px;
    height: 50px;
  }
  &:hover {
    background: #ddd;
    .del {
      display: block;
    }
  }
}
.content {
  margin-left: 10px;
  flex: 1;
  span {
    color: #2b4a78;
    cursor: pointer;
  }
  .time {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
  }
  .del {
    display: none;
  }
}

</style>